<template>
            <el-dialog
                title="任务详情"
                v-model="dialogVisible"
                width="1200"
                :close-on-click-modal="false"
                append-to-body
                @close="close"
                @open="openInit"
            >
                <div v-loading="detailLoading">
                    <el-descriptions border :column="6">
                        
            <el-descriptions-item label="软件名称" :span="2">
                {{ detail.name }}
            </el-descriptions-item>
          
            <el-descriptions-item label="软件编号" :span="2">
                {{ detail.code }}
            </el-descriptions-item>
          
            <el-descriptions-item label="软件分类" :span="2">
                {{ detail.softType }}
            </el-descriptions-item>
          
            <el-descriptions-item label="管理人员" :span="2">
                {{ detail.managerId }}
            </el-descriptions-item>
          
            <el-descriptions-item label="用途" :span="2">
                {{ detail.useWay }}
            </el-descriptions-item>
          
            <el-descriptions-item label="所属公司" :span="2">
                {{ detail.ownCompany }}
            </el-descriptions-item>
          
            <el-descriptions-item label="使用员工" :span="2">
                {{ detail.useUserIds }}
            </el-descriptions-item>
          
            <el-descriptions-item label="使用部门" :span="2">
                {{ detail.useDeptIds }}
            </el-descriptions-item>
          
            <el-descriptions-item label="来源" :span="2">
                {{ detail.comeWay }}
            </el-descriptions-item>
          
            <el-descriptions-item label="供应商" :span="2">
                {{ detail.supply }}
            </el-descriptions-item>
          
            <el-descriptions-item label="购置日期" :span="2">
                {{ detail.buyDate }}
            </el-descriptions-item>
          
            <el-descriptions-item label="购置价格(元)" :span="2">
                {{ detail.buyMoney }}
            </el-descriptions-item>
          
            <el-descriptions-item label="许可模式" :span="2">
                {{ detail.licensingType }}
            </el-descriptions-item>
          
            <el-descriptions-item label="许可数量" :span="2">
                {{ detail.licensingNum }}
            </el-descriptions-item>
          
            <el-descriptions-item label="版权类型" :span="2">
                {{ detail.copyrightType }}
            </el-descriptions-item>
          
            <el-descriptions-item label="授权开始日期" :span="2">
                {{ detail.useStartDate }}
            </el-descriptions-item>
          
            <el-descriptions-item label="授权结束日期" :span="2">
                {{ detail.useEndDate }}
            </el-descriptions-item>
          
            <el-descriptions-item label="软件版本" :span="2">
                {{ detail.softwareVersion }}
            </el-descriptions-item>
          
            <el-descriptions-item label="授权码" :span="2">
                {{ detail.authorizationCode }}
            </el-descriptions-item>
          
            <el-descriptions-item label="授权信息" :span="2">
                {{ detail.authorizationInfo }}
            </el-descriptions-item>
          
            <el-descriptions-item label="维保厂家" :span="2">
                {{ detail.repairFactory }}
            </el-descriptions-item>
          
            <el-descriptions-item label="维保厂家编码" :span="2">
                {{ detail.repairFactoryCode }}
            </el-descriptions-item>
          
            <el-descriptions-item label="售后联系人" :span="2">
                {{ detail.repairUser }}
            </el-descriptions-item>
          
            <el-descriptions-item label="售后联系人电话" :span="2">
                {{ detail.repairUserPhone }}
            </el-descriptions-item>
          
            <el-descriptions-item label="维保开始日期" :span="2">
                {{ detail.repairStartDate }}
            </el-descriptions-item>
          
            <el-descriptions-item label="维保结束日期" :span="2">
                {{ detail.repairEndDate }}
            </el-descriptions-item>
          
            <el-descriptions-item label="保修期(月)" :span="2">
                {{ detail.repairMonth }}
            </el-descriptions-item>
          
            <el-descriptions-item label="维保状态" :span="2">
                {{ detail.repairStatus }}
            </el-descriptions-item>
          
            <el-descriptions-item label="备注" :span="2">
                {{ detail.remark }}
            </el-descriptions-item>
          
            <el-descriptions-item label="附件" :span="2">
                {{ detail.upFiles }}
            </el-descriptions-item>
                    </el-descriptions>
                </div>
            </el-dialog>
        </template>

        <script setup name="CopyAssetsDetail">
        import { getInstanceDetail } from "../service";

        const detail = ref({});
        const originRow = ref({});
        const useApi = ref(false);
        const dialogVisible = ref(false);
        // 关闭
        function close() {
            dialogVisible.value = false;
        }

        const detailLoading = ref(false);
        async function infoById(detailId) {
            detailLoading.value = true;
            const result = await getInstanceDetail(detailId)
                .then((res) => res.data)
                .finally(() => {
                detailLoading.value = false;
                });
            detail.value = result;
        }

        function openInit() {
            if (useApi && originRow.value.id) {
                infoById(originRow.value.id);
            } else {
                detail.value = originRow.value;
            }
        }
        // 打开
        function open(row, api = false) {
            useApi.value = api;
            originRow.value = row;
            dialogVisible.value = true;
        }

        defineExpose({
            open,
        });
        </script>

        <style lang="scss" scoped>
        ::v-deep(.el-descriptions__label) {
            width: 100px;
            color: #909399 !important;
        }

        ::v-deep(.el-descriptions__content) {
            width: 300px !important;
            box-sizing: border-box;
        }
        </style>